#coding=utf-8
from socket import  *
HOST = ''
PORT = 21567
BUFZIZ = 1024
ADDR = (HOST,PORT)

tcpSerSock = socket(AF_INET,SOCK_STREAM)
tcpSerSock.bind(ADDR)
tcpSerSock.listen(5)


print('等待连接...')

tcpCliSock,addr = tcpSerSock.accept()
print('连接来自',addr)

while True:
    data = tcpSerSock.recv(BUFZIZ)

    if not data:
        tcpSerSock.close()
        break


    rstr = data.decode()
    print(rstr)

    tcpSerSock.sendfile(f'**{rstr}'.encode())

#     tcpCliSock.close()
# tcpSerSock.close()
#
